@model WorkFlowCore.BusinessDemo.Web.Models.OfficialSealApplicationViewModel
@using WorkFlowCore.BusinessDemo.Web.Entities
@{
    Layout = null;
}

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>公章申请详情（公开查看）</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background-color: #f8f9fa;
            padding: 20px 0;
        }
        .container {
            max-width: 1200px;
        }
        .card {
            box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
            border: 1px solid rgba(0, 0, 0, 0.125);
        }
        .card-header {
            background-color: #f8f9fa;
            border-bottom: 1px solid rgba(0, 0, 0, 0.125);
        }
        .form-label {
            font-weight: 600;
            color: #495057;
        }
        .form-control-plaintext {
            padding-left: 0;
            padding-right: 0;
        }
        .text-muted {
            color: #6c757d !important;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-lg-10">
                <div class="card">
                    <div class="card-header">
                        <h2 class="card-title mb-0">公章申请详情（公开查看）</h2>
                    </div>
                    <div class="card-body">
                        <h4 class="mb-4">公章申请信息</h4>
                        
                        <div class="row mb-3">
                            <div class="col-md-6">
                                <label class="form-label">@Html.DisplayNameFor(model => model.ApplicantName)</label>
                                <div class="form-control-plaintext">@Html.DisplayFor(model => model.ApplicantName)</div>
                            </div>
                            <div class="col-md-6">
                                <label class="form-label">@Html.DisplayNameFor(model => model.ApplicantDepartment)</label>
                                <div class="form-control-plaintext">@Html.DisplayFor(model => model.ApplicantDepartment)</div>
                            </div>
                        </div>

                        <div class="row mb-3">
                            <div class="col-md-6">
                                <label class="form-label">@Html.DisplayNameFor(model => model.ApplicationDate)</label>
                                <div class="form-control-plaintext">@Html.DisplayFor(model => model.ApplicationDate)</div>
                            </div>
                            <div class="col-md-6">
                                <label class="form-label">@Html.DisplayNameFor(model => model.SealType)</label>
                                <div class="form-control-plaintext">@Html.DisplayFor(model => model.SealType)</div>
                            </div>
                        </div>

                        <div class="row mb-3">
                            <div class="col-12">
                                <label class="form-label">@Html.DisplayNameFor(model => model.Reason)</label>
                                <div class="form-control-plaintext">@Html.DisplayFor(model => model.Reason)</div>
                            </div>
                        </div>

                        <div class="row mb-3">
                            <div class="col-md-6">
                                <label class="form-label">@Html.DisplayNameFor(model => model.UsageStartDate)</label>
                                <div class="form-control-plaintext">@Html.DisplayFor(model => model.UsageStartDate)</div>
                            </div>
                            <div class="col-md-6">
                                <label class="form-label">@Html.DisplayNameFor(model => model.UsageEndDate)</label>
                                <div class="form-control-plaintext">@Html.DisplayFor(model => model.UsageEndDate)</div>
                            </div>
                        </div>

                        <div class="row mb-3">
                            <div class="col-md-6">
                                <label class="form-label">@Html.DisplayNameFor(model => model.Quantity)</label>
                                <div class="form-control-plaintext">@Html.DisplayFor(model => model.Quantity)</div>
                            </div>
                            <div class="col-md-6">
                                <label class="form-label">@Html.DisplayNameFor(model => model.AttachedFilesInfo)</label>
                                <div class="form-control-plaintext">@Html.DisplayFor(model => model.AttachedFilesInfo)</div>
                            </div>
                        </div>

                        <div class="row mb-3">
                            <div class="col-md-6">
                                <label class="form-label">@Html.DisplayNameFor(model => model.WorkTaskId)</label>
                                <div class="form-control-plaintext">@Html.DisplayFor(model => model.WorkTaskId)</div>
                            </div>
                            <div class="col-md-6">
                                <label class="form-label">@Html.DisplayNameFor(model => model.CurrentWorkTaskStatusDisplay)</label>
                                <div class="form-control-plaintext">@Html.DisplayFor(model => model.CurrentWorkTaskStatusDisplay)</div>
                            </div>
                        </div>

                        <hr class="my-4">

                        <h5 class="text-muted mb-3">系统信息</h5>
                        
                        <div class="row mb-3">
                            <div class="col-md-6">
                                <label class="form-label">创建时间</label>
                                <div class="form-control-plaintext">@Html.DisplayFor(model => model.CreatedTime)</div>
                            </div>
                            <div class="col-md-6">
                                <label class="form-label">最后更新时间</label>
                                <div class="form-control-plaintext">@Html.DisplayFor(model => model.UpdatedTime)</div>
                            </div>
                        </div>

                        <div class="row mb-3">
                            <div class="col-md-6">
                                <label class="form-label">创建人ID</label>
                                <div class="form-control-plaintext">@Html.DisplayFor(model => model.CreatorUserId)</div>
                            </div>
                        </div>

                        <div class="mt-4 pt-3 border-top">
                            <div class="alert alert-info" role="alert">
                                <i class="bi bi-info-circle"></i>
                                此页面为公开查看模式，仅显示申请详情信息，不提供任何操作功能。
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>

    <!-- PostMessage 高度通信功能 -->
    <script>
    (function() {
        let lastHeight = 0;
        
        // 获取页面实际高度的函数
        function getPageHeight() {
            return Math.max(
                document.body.scrollHeight,
                document.body.offsetHeight,
                document.documentElement.clientHeight,
                document.documentElement.scrollHeight,
                document.documentElement.offsetHeight
            );
        }
        
        // 发送高度消息给父页面
        function sendHeightMessage() {
            const currentHeight = getPageHeight();
            
            // 只有当高度发生变化时才发送消息
            if (currentHeight !== lastHeight) {
                try {
                    // 向父页面发送消息
                    window.parent.postMessage({
                        event: 'setFormIframeHeight',
                        height: currentHeight
                    }, '*');
                    
                    lastHeight = currentHeight;
                    console.log('已发送高度消息至父页面:', currentHeight);
                } catch (error) {
                    console.warn('发送 postMessage 失败:', error);
                }
            }
        }
        
        // 页面加载完成后开始监听
        document.addEventListener('load', function() {
            // 立即发送一次
            setTimeout(sendHeightMessage, 100);
            
            // 定时检查高度变化（每秒一次）
            setInterval(sendHeightMessage, 1000);
            
            // 监听窗口大小变化
            window.addEventListener('resize', function() {
                setTimeout(sendHeightMessage, 100);
            });
        });
        
        // 页面完全加载后再发送一次
        window.addEventListener('load', function() {
            setTimeout(sendHeightMessage, 200);
        });
    })();
    </script>
</body>
</html>